const Queue = require('./queue')

const test1 = [5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4]
const test2 = []
for (let i = 0; i < 100; i++) test2.push(i)

function delRing(arrList) {
  const queue = new Queue()
  for (let i = 0; i < arrList.length; i++) queue.enqueue(arrList[i])

  let index = 0
  while (queue.size() !== 1) {
    const takeItem = queue.dequeue()
    index++
    if (index % 3 !== 0) queue.enqueue(takeItem)
  }

  return queue.head()
}

console.log(delRing(test1))
console.log(delRing(test2))
